package org.greenstone.gsdl3.service;

import org.greenstone.gsdl3.util.*;
import org.greenstone.gsdl3.core.* ;

import org.w3c.dom.* ;

public class KoruResponse {

    public Element response ;
    private Element koruData ;
    private Document doc ;

    public KoruResponse(Document doc, String service) {
	this.doc = doc ;
	
	response = doc.createElement(GSXML.RESPONSE_ELEM);
	response.setAttribute(GSXML.FROM_ATT, service);
	response.setAttribute(GSXML.TYPE_ATT, GSXML.REQUEST_TYPE_PROCESS);

        koruData = this.doc.createElement("koruData");
	response.appendChild(koruData) ;
    }

    public void addErrorMessage(String message) {
	Element e = this.doc.createElement("koruError");
	Text t = this.doc.createTextNode(message);
	e.appendChild(t);
	koruData.appendChild(e) ;
    }

    public void addElement(Element element) {
	koruData.appendChild(element) ;
    }
}